/*
 * @(#)MaintStaffHierarchyForm.java
 *
 * Copyright (c) 2003 DCIVision Ltd
 * All rights reserved.
 *
 * This software is the confidential and proprietary information of DCIVision
 * Ltd ("Confidential Information").  You shall not disclose such Confidential
 * Information and shall use it only in accordance with the terms of the license
 * agreement you entered into with DCIVision Ltd.
 */
package com.dcivision.staff.web;

import javax.servlet.http.HttpServletRequest;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionMapping;

import com.dcivision.framework.ApplicationException;
import com.dcivision.framework.TextUtility;
import com.dcivision.framework.bean.AbstractBaseObject;
import com.dcivision.framework.web.AbstractActionForm;
import com.dcivision.staff.bean.StaffHierarchy;

/**
  MaintStaffHierarchyForm.java

  This class is the for web form purpose.

  @author      Wong Yam Lee
  @company     DCIVision Limited
  @creation date   28/07/2003
  @version     $Revision: 1.3 $
*/

public class MaintStaffHierarchyForm extends AbstractActionForm {

  public static final String REVISION = "$Revision: 1.3 $";

  private String name = null;
  private String levelNo = null;
  private String parentID = null;
  private String address = null;
  private String countryID = null;
  private String phoneNo = null;
  private String faxNo = null;
  private String url = null;

  public MaintStaffHierarchyForm() {
    super();
  }

  public String getName() { 
    return(this.name);
  }

  public void setName(String name) { 
    this.name = name;
  }

  public String getLevelNo() { 
    return(this.levelNo);
  }

  public void setLevelNo(String levelNo) { 
    this.levelNo = levelNo;
  }

  public String getParentID() { 
    return(this.parentID);
  }

  public void setParentID(String parentID) { 
    this.parentID = parentID;
  }

  public String getAddress() { 
    return(this.address);
  }

  public void setAddress(String address) { 
    this.address = address;
  }

  public String getCountryID() { 
    return(this.countryID);
  }

  public void setCountryID(String countryID) { 
    this.countryID = countryID;
  }

  public String getPhoneNo() { 
    return(this.phoneNo);
  }

  public void setPhoneNo(String phoneNo) { 
    this.phoneNo = phoneNo;
  }

  public String getFaxNo() { 
    return(this.faxNo);
  }

  public void setFaxNo(String faxNo) { 
    this.faxNo = faxNo;
  }

  public String getUrl() { 
    return(this.url);
  }

  public void setUrl(String url) { 
    this.url = url;
  }
  public ActionErrors validate(ActionMapping mapping, HttpServletRequest request) {
    return super.validate(mapping, request);
  }

  public void reset(ActionMapping mapping, HttpServletRequest request) {
    super.reset(mapping, request);
    this.setID(null);
    this.setName(null);
    this.setLevelNo(null);
    this.setParentID(null);
    this.setAddress(null);
    this.setCountryID(null);
    this.setPhoneNo(null);
    this.setFaxNo(null);
    this.setUrl(null);
    this.setRecordStatus(null);
    this.setUpdateCount(null);
    this.setCreatorID(null);
    this.setCreateDate(null);
    this.setUpdaterID(null);
    this.setUpdateDate(null);
  }

  public AbstractBaseObject getFormData() throws ApplicationException {
    StaffHierarchy tmpStaffHierarchy = new StaffHierarchy();
    tmpStaffHierarchy.setID(TextUtility.parseIntegerObj(this.getID()));
    tmpStaffHierarchy.setName(this.getName());
    tmpStaffHierarchy.setLevelNo(TextUtility.parseIntegerObj(this.getLevelNo()));
    tmpStaffHierarchy.setParentID(TextUtility.parseIntegerObj(this.getParentID()));
    tmpStaffHierarchy.setAddress(this.getAddress());
    tmpStaffHierarchy.setCountryID(TextUtility.parseIntegerObj(this.getCountryID()));
    tmpStaffHierarchy.setPhoneNo(this.getPhoneNo());
    tmpStaffHierarchy.setFaxNo(this.getFaxNo());
    tmpStaffHierarchy.setUrl(this.getUrl());
    tmpStaffHierarchy.setRecordStatus(this.getRecordStatus());
    tmpStaffHierarchy.setUpdateCount(TextUtility.parseIntegerObj(this.getUpdateCount()));
    tmpStaffHierarchy.setCreatorID(TextUtility.parseIntegerObj(this.getCreatorID()));
    tmpStaffHierarchy.setCreateDate(parseTimestamp(this.getCreateDate()));
    tmpStaffHierarchy.setUpdaterID(TextUtility.parseIntegerObj(this.getUpdaterID()));
    tmpStaffHierarchy.setUpdateDate(parseTimestamp(this.getUpdateDate()));
    return tmpStaffHierarchy;
  }

  public void setFormData(AbstractBaseObject baseObj) throws ApplicationException {
    StaffHierarchy tmpStaffHierarchy = (StaffHierarchy)baseObj;
    this.setID(TextUtility.formatIntegerObj(tmpStaffHierarchy.getID()));
    this.setName(tmpStaffHierarchy.getName());
    this.setLevelNo(TextUtility.formatIntegerObj(tmpStaffHierarchy.getLevelNo()));
    this.setParentID(TextUtility.formatIntegerObj(tmpStaffHierarchy.getParentID()));
    this.setAddress(tmpStaffHierarchy.getAddress());
    this.setCountryID(TextUtility.formatIntegerObj(tmpStaffHierarchy.getCountryID()));
    this.setPhoneNo(tmpStaffHierarchy.getPhoneNo());
    this.setFaxNo(tmpStaffHierarchy.getFaxNo());
    this.setUrl(tmpStaffHierarchy.getUrl());
    this.setRecordStatus(tmpStaffHierarchy.getRecordStatus());
    this.setUpdateCount(TextUtility.formatIntegerObj(tmpStaffHierarchy.getUpdateCount()));
    this.setCreatorID(TextUtility.formatIntegerObj(tmpStaffHierarchy.getCreatorID()));
    this.setCreateDate(formatTimestamp(tmpStaffHierarchy.getCreateDate()));
    this.setUpdaterID(TextUtility.formatIntegerObj(tmpStaffHierarchy.getUpdaterID()));
    this.setUpdateDate(formatTimestamp(tmpStaffHierarchy.getUpdateDate()));
  }
}
